import {request} from './request'

//请求详情页数据
export function getDetail(iid) {
  return request({
    url: '/detail',
    params: {
     iid
    }
  })
}
//请求推荐数据
export function getRecommend() {
  return request({
    url: '/recommend/',
  })


}

//糅合商品信息
export  class  Goods{
  //构造一个新的对象来接收所想要的杂乱信息
  constructor (itemInfo,columns,services) {
    itemInfo.discountDese = undefined
    itemInfo.price = undefined
    this.title=itemInfo.title
    this.desc=itemInfo.desc
    this.newPrice=itemInfo.price
    this.oldPrice=itemInfo.oldPrice
    this.discount=itemInfo.discountDese
    this.realPrice=itemInfo.lowNowPrice
    this.columns=columns
    this.services=services

  }
}
//糅合店铺信息
export  class  Shop{
  constructor (shopInfo) {
    this.logo=shopInfo.shopLogo;
    this.name=shopInfo.name;
    // this.fans=shopInfo.cFans;
    this.sells=shopInfo.cSells;
    this.score=shopInfo.score;
    this.goodsCount=shopInfo.cGoods
  }
}
//获取商店参数信息
export  class GoodsParam {
  constructor (info, rule) {
    this.image = info.image ?info.image[0] : '';
    this.infos = info.set;
    this.sizes = rule.tables;
  }
}

